#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+1000;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL a[50],b[50];
LL sum1[50],sum2[50];
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  LL t;cin>>t;
  while(t--){
        memset(sum1,0,sizeof(sum1));
        memset(sum2,0,sizeof(sum2));
        memset(a,0,sizeof(a));memset(b,0,sizeof(b));
        LL x,y;cin>>x>>y;
        for(LL i=0;i<=30;i++){
            if(x&(1<<i)) a[i]=1;
            else a[i]=0;
            if(y&(1<<i)) b[i]=1;
            else b[i]=0;
        }
        if(x>y){
            cout<<"NO"<<"\n";
        }
        else{
            for(LL i=1;i<=30;i++){
                a[i]=a[i-1]+a[i];
                b[i]=b[i-1]+b[i];
            }
       /*     for(LL i=1;i<=30;i++) cout<<sum1[i]<<" ";
            cout<<"\n";
            for(LL i=1;i<=30;i++) cout<<sum2[i]<<" ";
            cout<<"\n";*/
            bool f=1;
            for(LL i=0;i<=30;i++){
                if(a[i]<b[i]){
                    f=0;
                    break;
                }
            }
            if(f==1) cout<<"YES"<<"\n";
            else cout<<"NO"<<"\n";
        }
  }
return 0;
}
